'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1548494326322_1671';

  // add your config here
  config.middleware = [];

  config.view = {
    defaultViewEngine: 'nunjucks',
    mapping: {
      '.tpl': 'nunjucks',
    },
  };

  config.urlConfig = {
    serverUrl: 'https://www.yunzhijia.com/space/c',
    queryUserUrl: 'https://www.yunzhijia.com/attendance/rest/web-record/clockInUsers',
  };

  config.cluster = {
    listen: {
      port: 8010,
    },
  };

  config.security = {
    csrf: {
      enable: false,
    },
  };

  exports.multipart = { // 文件上传模式
    mode: 'file',
    fileExtensions: [ '.xlsx', 'pdf' ], // 增加对 xlsx 扩展名的文件支持
  };


  config.headers = {
    authority: 'www.yunzhijia.com',
    dnt: 1,
    origin: 'https://www.yunzhijia.com',
    referer: 'https://www.yunzhijia.com/home/?m=open&a=login',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
  };

  config.session = {
    key: 'SESSION_ID', // 设置session cookie里面的key
    maxAge: 3600 * 1000 / 2, // 设置过期时间
    httpOnly: true,
    encrypt: true,
  };

  return config;
};

